﻿using ACM.MES.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;

namespace ACM.MES.工序
{
    public class EfCoreOperationRepository : EfCoreRepository<MESDbContext, Operation, Guid>,
        IOperationRepository
    {
        public EfCoreOperationRepository(IDbContextProvider<MESDbContext> dbContextProvider) : base(dbContextProvider)
        {
        }

        public async Task<Operation> FindByDescriptionAsync(string description)
        {
            var dbSet = await GetDbSetAsync();
            return await dbSet.FirstOrDefaultAsync(author => author.Description == description);
        }

        public async Task<Operation> FindByOpCodeAsync(string opCode)
        {
            var dbSet = await GetDbSetAsync();
            return await dbSet.FirstOrDefaultAsync(author => author.OpCode == opCode);
        }

        public Task<List<Operation>> GetListAsync(int skipCount, int maxResultCount, string sorting, string filter = null)
        {
            throw new NotImplementedException();
        }
    }
}
